import json
import time

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

from config import URL, LOCAL_PATH


def web_driver():
    # 配置驱动-谷歌浏览器
    path = r"D:\Programs\Python\Python313\chromedriver.exe"
    ser = Service(executable_path=path)
    driver = webdriver.Chrome(service=ser)
    # 暂停
    time.sleep(3)
    # # 打开web浏览器
    # driver.get(url)
    # 窗口最大化
    driver.maximize_window()
    driver.implicitly_wait(10)
    return  driver

def driver_quit(driver):
    time.sleep(3)
    driver.quit()

# 获取测试数据
def get_json_data(file_path):
    test_data = []
    with open(file_path, "r", encoding="utf-8") as f:
        json_data = json.load(f)
        for data in json_data:
            test_data.append(tuple(data.values()))
        return test_data

if __name__ == '__main__':
    driver = web_driver()
    driver.get("http://www.litemall360.com:8082/")
    time.sleep(5)
    # driver_quit(driver)
    # print(get_json_data(rf"{LOCAL_PATH}\data\admin_login"))